package net.qiqb.spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

import java.util.Map;

public class QiqbContextRefreshedEventListener implements ApplicationListener<ContextRefreshedEvent> {

    private SpringExecutionContext springExecutionContext;

    @Autowired
    public void setSpringExecutionContext(SpringExecutionContext springExecutionContext) {
        this.springExecutionContext = springExecutionContext;
    }

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        final ApplicationContext applicationContext = event.getApplicationContext();

        springExecutionContext.initExecutionContext(applicationContext);
    }
}
